package com.binest.investorInclusionMain.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.binest.common.annotation.Log;
import com.binest.common.core.controller.BaseController;
import com.binest.common.core.domain.AjaxResult;
import com.binest.common.enums.BusinessType;
import com.binest.investorInclusionMain.domain.InvestorInclusionMain;
import com.binest.investorInclusionMain.service.IInvestorInclusionMainService;
import com.binest.common.utils.poi.ExcelUtil;
import com.binest.common.core.page.TableDataInfo;

/**
 * 投资机构收录主Controller
 * 
 * @author wwd
 * @date 2024-01-23
 */
@RestController
@RequestMapping("/investorInclusionMain")
public class InvestorInclusionMainController extends BaseController
{
    @Autowired
    private IInvestorInclusionMainService investorInclusionMainService;

    /**
     * 查询投资机构收录主列表
     */
    @PreAuthorize("@ss.hasPermi('investorInclusionMain:investorInclusionMain:list')")
    @GetMapping("/list")
    public TableDataInfo list(InvestorInclusionMain investorInclusionMain)
    {
        startPage();
        List<InvestorInclusionMain> list = investorInclusionMainService.selectInvestorInclusionMainList(investorInclusionMain);
        return getDataTable(list);
    }

    /**
     * 导出投资机构收录主列表
     */
    @PreAuthorize("@ss.hasPermi('investorInclusionMain:investorInclusionMain:export')")
    @Log(title = "投资机构收录主", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, InvestorInclusionMain investorInclusionMain)
    {
        List<InvestorInclusionMain> list = investorInclusionMainService.selectInvestorInclusionMainList(investorInclusionMain);
        ExcelUtil<InvestorInclusionMain> util = new ExcelUtil<InvestorInclusionMain>(InvestorInclusionMain.class);
        util.exportExcel(response, list, "投资机构收录主数据");
    }

    /**
     * 获取投资机构收录主详细信息
     */
    @PreAuthorize("@ss.hasPermi('investorInclusionMain:investorInclusionMain:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(investorInclusionMainService.selectInvestorInclusionMainById(id));
    }

    /**
     * 新增投资机构收录主
     */
    @PreAuthorize("@ss.hasPermi('investorInclusionMain:investorInclusionMain:add')")
    @Log(title = "投资机构收录主", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody InvestorInclusionMain investorInclusionMain)
    {
        return toAjax(investorInclusionMainService.insertInvestorInclusionMain(investorInclusionMain));
    }

    /**
     * 修改投资机构收录主
     */
    @PreAuthorize("@ss.hasPermi('investorInclusionMain:investorInclusionMain:edit')")
    @Log(title = "投资机构收录主", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody InvestorInclusionMain investorInclusionMain)
    {
        return toAjax(investorInclusionMainService.updateInvestorInclusionMain(investorInclusionMain));
    }

    /**
     * 删除投资机构收录主
     */
    @PreAuthorize("@ss.hasPermi('investorInclusionMain:investorInclusionMain:remove')")
    @Log(title = "投资机构收录主", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(investorInclusionMainService.deleteInvestorInclusionMainByIds(ids));
    }
}
